/* 
浏览器端请                      服务器响应
    / 或 /index.html            '首页'                       
    /about.html                 '关于'
    其他                         '您所请求的页面不存在'
*/

let http = require('http')

let server = http.createServer()

server.on('request', function(request,response){
    response.setHeader('content-type','text/plain;charset=utf-8')
    if(request.url === '/' || request.url === '/index.html'){
        response.write('首页')
        response.end()
    }else if(request.url === '/about.html' ){
        response.write('关于')
        response.end()
    }else{
        response.statusCode = 404;
        response.write('您所请求的页面不存在')
        response.end();
    }
})

server.listen('4201', function(){
    console.log('server is runing ...');
})
